import request from '@/utils/request'

/**
 * 获取权限列表数据
 * **/

export function getPermissionList() {
  return request({
    url: '/sys/permission',
    method: 'GET'
  })
}

/**
 *  新增权限
 * */
export function addPermission(data) {
  return request({
    url: '/sys/permission',
    method: 'POST',
    data
  })
}

/**
 *  删除权限
 * */
export function delPermission(id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'DELETE'
  })
}

/**
 * 通过id获取权限详情
 * ***/
export function getPermissionDetail(id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'GET'
  })
}

/**
 * 保存修改权限
 * ***/
export function updatePermission(data) {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'PUT',
    data
  })
}

